package com.chb.dto;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * @Author: WangGang
 * @Date: 2021/10/7
 * @Description: 统一返回对象
 */
@Setter
@Getter
@NoArgsConstructor
public class AppResultDTO<T> implements Serializable {

    private static final long serialVersionUID = -5135597394506882690L;

    //调用成功标志
    private boolean success = true;

    //结果集
    private T data;

    //提示信息
    private String message = "成功";

    //状态编码
    private String code = "200";


    //设置success
    public AppResultDTO<T> success(boolean success) {
        this.success = success;
        return this;
    }

    //设置data
    public  AppResultDTO data(T data) {
        this.data = data;
        return this;
    }

    //设置code
    public AppResultDTO<T> code(String code) {
        this.code = code;
        return this;
    }

    //设置message
    public AppResultDTO<T> message(String message) {
        this.message = message;
        return this;
    }



}
